Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
ts-jest-resolver
Advanced tools
A resolver for `jest` that uses same strategy as TS when resolving files with JavaScript extension (".js").
A resolver for jest
that uses the same strategy as TS when resolving files with JavaScript extensions (".js", ".jsx", ".cjs" and ".mjs"). It works pretty well with ts-jest
or babel
with @babel/preset-typescript
.
jest-resolver
types.ts-jest
, ts-jest-resolver
uses itself as jest's resolver.This library is published in the NPM registry and can be installed using any compatible package manager.
npm install ts-jest-resolver --save
# For Yarn, use the command below.
yarn add ts-jest-resolver
After installation, you can set "ts-jest-resolver"
as jest's resolver.
// jest.config.js
module.exports = {
preset: "ts-jest",
resolver: "ts-jest-resolver",
};
It changes module's extension to resolve in the same way as TypeScript.
When importing from path with JavaScript extension (".js" or ".jsx"):
import EventEmitter from './EventEmitter.js';
It tries to resolve to a path with ".tsx";
import EventEmitter from './EventEmitter.tsx';
If no file was found, it tries to resolve to a path with ".ts";
import EventEmitter from './EventEmitter.ts';
If no file was found, it resolves to original path (with ".js" or ".jsx").
import EventEmitter from './EventEmitter.js';
When importing from path with ES or CommonJS modules (".mjs" and ".cjs" respectively):
Ex.
import parse, { Tokenizer } from './parser.mjs'
import { discoverPath } from './getFiles.cjs';
It tries to resolve to paths with ".mts" and ".cts".
Ex.
import parse, { Tokenizer } from './parser.mts'
import { discoverPath } from './getFiles.cts';
If no files were found, it resolves to original paths (with ".mjs" and ".cjs").
Ex.
import parse, { Tokenizer } from './parser.mjs'
import { discoverPath } from './getFiles.cjs';
Released under MIT License.
FAQs
A resolver for `jest` that uses same strategy as TS when resolving files with JavaScript extension (".js").
The npm package ts-jest-resolver receives a total of 16,829 weekly downloads. As such, ts-jest-resolver popularity was classified as popular.
We found that ts-jest-resolver demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.